function delElderlyExamineAgree(diarycontent){
    var examineUser = $("#spanUserName").text();
    var protocol = window.location.protocol;
    var host = window.location.host;
    layer.confirm('确定通过审核吗?',
        {icon: 3, title: '系统提示'},
        function (index) {
            var id = diarycontent;
            $.ajax({
                type : 'POST',
                url : '/delElderlyExamineAgree',
                data : {id:id,examineUser:examineUser},
                success:function (data) {

                    if (data == "OK"){
                        layer.msg('操作成功', {
                            icon: 1,
                            shadeClose: true,
                            skin: 'layui-layer-molv',
                            time: 2000 //2秒关闭（如果不配置，默认是3秒）
                        }, function(){
                            window.location.href = window.location.href;
                        });
                    }else {
                        layer.open({
                            title: '提示信息',
                            anim: 0,
                            resize:false,//是否可以拉伸  默认true
                            icon: 2,
                            shadeClose: true,
                            skin: 'layui-layer-molv',
                            content: data
                        });
                    }
                },
                error: function (e) {
                    console.log(e)
                }
            });
            layer.close(index);
        });
}


function delElderlyExamineRefuse(diarycontent){
    var examineUser = $("#spanUserName").text();
    var protocol = window.location.protocol;
    var host = window.location.host;
    layer.confirm('确定拒绝请求吗?',
        {icon: 3, title: '系统提示'},
        function (index) {
            var id = diarycontent;
            $.ajax({
                type : 'POST',
                url : '/delElderlyExamineRefuse',
                data : {id:id,examineUser:examineUser},
                success:function (data) {

                    if (data == "OK"){
                        layer.msg('操作成功', {
                            icon: 1,
                            shadeClose: true,
                            skin: 'layui-layer-molv',
                            time: 2000 //2秒关闭（如果不配置，默认是3秒）
                        }, function(){
                            window.location.href = window.location.href;
                        });
                    }else {
                        layer.open({
                            title: '提示信息',
                            anim: 0,
                            resize:false,//是否可以拉伸  默认true
                            icon: 2,
                            shadeClose: true,
                            skin: 'layui-layer-molv',
                            content: data
                        });
                    }
                },
                error: function (e) {
                    console.log(e)
                }
            });
            layer.close(index);
        });
}

function agreeDelElderly(){
    var checks = new Array();
    var examineUser = $("#spanUserName").text();
    checks = $('input[type="checkbox"]:checked').map(function(){

        return $(this).val();

    }).get()
    console.log(checks);
    var protocol = window.location.protocol;
    var host = window.location.host;
    if (checks.length == 0){
        layer.open({
            title: '提示信息',
            anim: 0,
            resize:false,//是否可以拉伸  默认true
            icon: 2,
            shadeClose: true,
            skin: 'layui-layer-molv',
            content: "请至少选中一行数据进行操作"
        });
    }else {
        layer.confirm('确定通过审核吗?', {icon: 3, title: '系统提示'}, function (index) {
            for (var i = 0; i < checks.length; i++) {
                var id = checks[i];
                $.ajax({
                    type: 'POST',
                    url: '/delElderlyExamineAgree',
                    data: {id: id},
                    success: function (data) {
                        if (data == "OK") {
                            window.location.href = window.location.href;
                        } else {
                            layer.open({
                                title: '提示信息',
                                anim: 0,
                                resize: false,//是否可以拉伸  默认true
                                icon: 2,
                                shadeClose: true,
                                skin: 'layui-layer-molv',
                                content: data
                            });
                        }
                    },
                    error: function (e) {
                        console.log(e)
                    }
                });

            }
            layer.close(index);
        });
    }
}

function refuseDelElderly(){
    var checks = new Array();
    var examineUser = $("#spanUserName").text();
    checks = $('input[type="checkbox"]:checked').map(function(){

        return $(this).val();

    }).get()
    console.log(checks);
    var protocol = window.location.protocol;
    var host = window.location.host;
    if (checks.length == 0){
        layer.open({
            title: '提示信息',
            anim: 0,
            resize:false,//是否可以拉伸  默认true
            icon: 2,
            shadeClose: true,
            skin: 'layui-layer-molv',
            content: "请至少选中一行数据进行操作"
        });
    }else {
        layer.confirm('确定拒绝请求吗?', {icon: 3, title: '系统提示'}, function (index) {
            for (var i = 0; i < checks.length; i++) {
                var id = checks[i];
                $.ajax({
                    type: 'POST',
                    url: '/delElderlyExamineRefuse',
                    data: {id: id},
                    success: function (data) {
                        if (data == "OK") {
                            window.location.href = window.location.href;
                        } else {
                            layer.open({
                                title: '提示信息',
                                anim: 0,
                                resize: false,//是否可以拉伸  默认true
                                icon: 2,
                                shadeClose: true,
                                skin: 'layui-layer-molv',
                                content: data
                            });
                        }
                    },
                    error: function (e) {
                        console.log(e)
                    }
                });

            }
            layer.close(index);
        });
    }
}